#!/usr/bin/python3

import os
import configparser


class ConfigTool(object):
    def __init__(self):
        self.conf = configparser.ConfigParser()

    @staticmethod
    def get_current_path():
        return os.path.dirname(os.path.realpath(__file__))

    def build_path(self, config_path):
        self.conf.read(config_path, encoding='utf-8-sig')

    def get(self, area, key):
        return self.conf.get(area, key)


if __name__ == '__main__':
    config = ConfigTool()
    config.build_path(r'D:\commercial_opportunity_zhu\config\config.ini')
    url = config.get('TestUser', 'name')
    print(url)
